package org.cklxh.waptime;

import org.waptime.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class WaptimeActivity extends Activity {
	
	//静态，便于其它类中调用。
	private static WaptimeActivity activityObject;
	//其它线程中，要使用Handler才能修改界面。
	private WaptimeHandler waptimeHandler;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		activityObject=this;
		waptimeHandler=new WaptimeHandler();
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		/*
		TextView tv=new TextView(this);
		tv.setId(111);
		tv.setText("aaaaaaaaaaa");
		setContentView(tv);
		*/
		
		//DigitalClock localTimeDC=(DigitalClock)findViewById(R.id.localTime_DC);
		
		//localTimeDC.setTime(0);
		//localTimeDC.setVisibility(View.VISIBLE);
		
		//刷新时间按钮
		Button refreshTimeBtn=(Button)findViewById(R.id.refresh_btn);
		refreshTimeBtn.setOnClickListener(new RefreshOnClickListener());
		
		

		//矫正时间按钮
		Button setTimeBtn=(Button)findViewById(R.id.settime_btn);
		setTimeBtn.setOnClickListener(new SetTimeOnClickListener());
		

		//退出按钮
		Button exitBtn=(Button)findViewById(R.id.exit_btn);
		exitBtn.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View view) {
				finish();
			}
			
		});
		
		
		
		//SystemClock.setCurrentTimeMillis();
		//System.exit(0);
		//finish();
		
	}

	
	public WaptimeHandler getWaptimeHandler() {
		return waptimeHandler;
	}

	public static WaptimeActivity getActivityObject(){
		return activityObject;
	}


	public void showMsg(String msg){
		
		Toast.makeText(getApplicationContext(), msg,Toast.LENGTH_SHORT).show();
		
	}
}